package com.ht.medicaltreatment.adapter

import android.widget.ImageView
import com.bumptech.glide.Glide
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.ht.medicaltreatment.R
import com.ht.medicaltreatment.base.BaseUrl
import com.ht.medicaltreatment.bean.SubmitConsumableJSON

class SubjectRecordAdapter : BaseQuickAdapter<SubmitConsumableJSON.ProjectConsumableListBean,
        BaseViewHolder>(R.layout.item_subject_record_layout){

    init {
        addChildClickViewIds(R.id.tvCount)
    }

    override fun convert(holder: BaseViewHolder, item: SubmitConsumableJSON.ProjectConsumableListBean) {
        holder.setText(R.id.tvXingHao,"型号："+item.model)
        holder.setText(R.id.tvGuiGe,"规格："+item.specification)
        holder.setText(R.id.tvPinPai,"品牌："+item.brand)
        holder.setText(R.id.tvCaiZhi,"材质："+item.material)
        holder.setText(R.id.tvCount,"${item.number}")

        val imgIcon = holder.getView<ImageView>(R.id.imgIcon)
        Glide.with(context)
            .load(BaseUrl.baseUrl()+item.picturePath)
            .into(imgIcon)
    }
}
